package com.deyang.adapter;

import android.app.Activity;
import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.deyang.entity.MailModel;
import com.deyang.maillist.R;

import java.util.List;


/**
 * @author wangdyang
 * @createDate 2018年7月21日19:37:34
 * @desc 联系人
 */
public class SearchMailAdapter extends BaseQuickAdapter<MailModel, BaseViewHolder> {

    public SearchMailAdapter(Activity activity, @Nullable List<MailModel> data) {
        super(R.layout.item_mail, data);
    }


    @Override
    protected void convert(BaseViewHolder helper, MailModel item) {
        if ("1".equals(item.getSex())){
            helper.setBackgroundRes(R.id.iv_sex,R.mipmap.default_mail_man);
        }else {
            helper.setBackgroundRes(R.id.iv_sex,R.mipmap.default_mail_wuman);
        }
        helper.setText(R.id.tv_name, item.getName());
        helper.setText(R.id.tv_duty, item.getDuty());
    }
}
